package com.cheng.im.service.group.controller;

import com.cheng.im.service.common.resp.CommonResult;
import com.cheng.im.service.group.model.req.*;
import com.cheng.im.service.group.service.ImGroupMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "群成员")
@RestController
@RequestMapping("v1/group/member")
public class ImGroupMemberController {

    @Resource
    ImGroupMemberService imGroupMemberService;

    @ApiOperation(value = "导入群成员")
    @PostMapping("/importGroupMember")
    public CommonResult importGroupMember(@RequestBody @Validated ImportGroupMemberReq req)  {
        return imGroupMemberService.importGroupMember(req);
    }

    @ApiOperation(value = "新增群成员")
    @PostMapping("/add")
    public CommonResult addMember(@RequestBody @Validated AddGroupMemberReq req)  {
        return imGroupMemberService.addMember(req);
    }

    @ApiOperation(value = "移除群成员")
    @DeleteMapping("/remove")
    public CommonResult removeMember(@RequestBody @Validated RemoveGroupMemberReq req)  {
        return imGroupMemberService.removeMember(req);
    }

    @ApiOperation(value = "修改群成员")
    @PutMapping("/update")
    public CommonResult updateGroupMember(@RequestBody @Validated UpdateGroupMemberReq req)  {
        return imGroupMemberService.updateGroupMember(req);
    }

    @ApiOperation(value = "禁言")
    @PutMapping("/speak")
    public CommonResult speak(@RequestBody @Validated SpeaMemberReq req)  {
        return imGroupMemberService.speak(req);
    }

}
